#include<cstdio>
#include <cmath>
#include <algorithm>   // For next_permutation()

using namespace std;
int n;//a矩阵的大小是n*n的

double count_Determinant(double**det,int n);
//返回a矩阵行列式的值,其中det为行列式，n为行列式的阶数

int main()
{
    scanf("%d",&n);
    auto**a=new double*[n+1];//动态内存分配
    for(int i=0;i<=n;i++)
        a[i]=new double[n+1];
    for(int i=1;i<=n;++i)
        for(int j=1;j<=n;++j)
            scanf("%lf",&a[i][j]);
    printf("%.5lf",count_Determinant(a,n));
}

/* 请在这里填写答案 */
int getNi(int aaa[],int n)
{
    int ans=0;
    for(int i=1;i<=n;++i)
        for(int j=1;j<i;++j)
            if(aaa[i]<aaa[j])
                ++ans;
    return ans&1?-1:1;
}
double count_Determinant(double**det,int n)
{
    double ans=0;
    int*aaa=new int[n+1];
    for(int i=1;i<=n;aaa[i]=i,++i);
    do
    {
        double tmp=1;
        for(int i=1;i<=n;++i)
            tmp*=det[i][aaa[i]];
        ans+=tmp*getNi(aaa,n);
    }while(next_permutation(aaa+1,aaa+n+1));
    return ans;
}